package pers.cz.postgirl.admin;

import pers.cz.postgirl.adapter.eform.EformDaoCrudPlugin;
import pers.cz.postgirl.adapter.eform.EformPlugin;
import pers.cz.postgirl.adapter.geequery.GeequeryPlugin;
import pers.cz.postgirl.adapter.http.servlet.HttpPlugin;
import pers.cz.postgirl.adapter.mybatis.MybatisPlugin;
import pers.cz.postgirl.util.JefLog;

import java.lang.instrument.Instrumentation;

/**
 * @program: postgirl-client
 * @description: 启动类
 * @author: Cheng Zhi
 * @create: 2023-05-23 10:51
 **/
public class PostGrilClientApplication {
    public static void premain(String agentArgs, Instrumentation inst) {

        JefLog log = new JefLog(PostGrilClientApplication.class);
        log.info("=========================================================");
        log.info("==     ~~~   PostGirl接口录制客户端启动成功 (测试版)~~~==");
        log.info("=========================================================");

        log.info("agentArgs : " + agentArgs);
        if (agentArgs != null) {
            // 读取配置文件路径，如果不配置，默认读取写死的目录
            System.setProperty("jef.properties", agentArgs);
        } else {
            System.setProperty("jef.properties", "file://home/acctuser/ams_ims/postgirl/config/postgirl-colleciton-config.properties");
        }

        inst.addTransformer(new MybatisPlugin());
        inst.addTransformer(new HttpPlugin());
        inst.addTransformer(new EformPlugin());
        inst.addTransformer(new EformDaoCrudPlugin());
        inst.addTransformer(new GeequeryPlugin());
    }
}
